/*
 * VHStandingsTypeSelector.java
 * Created on 12 juil. 2009
 *
 * VirtualHockey Internet Platform
 * http://code.google.com/p/virtualhockey/
 *
 * Copyright (c) 2005-2009, Jens and Jan Janke (VirtualHockey Project)
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program. If not, see http://www.gnu.org/licenses/.
 */
package com.hockeo.vhweb.client.ui.widget;

import com.hockeo.vhweb.client.VHMain;
import com.hockeo.vhweb.client.res.VHResConstants;
import com.hockeo.vhweb.client.ui.base.VHSelector;
import com.hockeo.vhweb.client.utils.VHJsData;
import com.hockeo.vhweb.client.utils.VHJsSimpleData;
import com.hockeo.vhweb.client.utils.enums.VHJsMatchType;

/**
 * Allows to select between the different standings types.
 *
 * @version $Id$
 * @author jjanke
 */
public class VHMatchTypeSelector extends VHSelector
{
  private VHJsSimpleData d_dataDefault;

  public VHMatchTypeSelector()
  {
    VHResConstants c = VHMain.getConstants();

    d_dataDefault = new VHJsSimpleData( VHJsMatchType.ALL.name(), c.allMatches() );

    getStore().add( d_dataDefault );
    getStore().add( new VHJsSimpleData( VHJsMatchType.HOME.name(), c.homeMatches() ) );
    getStore().add( new VHJsSimpleData( VHJsMatchType.AWAY.name(), c.awayMatches() ) );

    getCombobox().setValue( d_dataDefault );
    getCombobox().setValueField( VHJsData.PARAM_ID );
    getCombobox().setDisplayField( VHJsSimpleData.PARAM_LABEL );
    getCombobox().setWidth( 200 );
    setInitialised( true );
  }

  public void selectDefault()
  {
    getCombobox().setValue( d_dataDefault );
  }
}
